//
//  GRImageTitleCell.h
//  SleepingElf
//
//  Created by karong on 2023/6/13.
//

#import "GRImageTitleCell.h"

@interface GRImageTitleCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *subTitleLabel;
@property (nonatomic, strong) UIImageView *coverImage;


@end

@implementation GRImageTitleCell

- (void)setUI
{
    [super setUI];
    self.bannerImageView.layer.cornerRadius = 0;
    
    [self.bannerView addSubview:self.coverImage];
    [self.coverImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.mas_equalTo(self.bannerView);
    }];
    
    [self.bannerView addSubview:self.subTitleLabel];
    [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.bannerView).offset(16);
        make.right.mas_equalTo(self.bannerView).offset(-16);
        make.bottom.mas_equalTo(self.bannerView).offset(-20);
    }];
    [self.bannerView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.bannerView).offset(16);
        make.right.mas_equalTo(self.bannerView).offset(-16);
        make.bottom.mas_equalTo(self.subTitleLabel.mas_top).offset(-4);
    }];
    
}

- (void)setDataWithObject:(id)object {
//    if (SEIsNullOrEmpty(object.name)) {
//        self.titleLabel.hidden = YES;
//    }
//    else {
//        self.titleLabel.hidden = NO;
//        self.titleLabel.text = object.name;
//    }
//    if (SEIsNullOrEmpty(object.desc)) {
//        self.subTitleLabel.hidden = YES;
//    }
//    else {
//        self.subTitleLabel.hidden = NO;
//        self.subTitleLabel.text = object.desc;
//    }
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.font = [UIFont systemFontOfSize:20 weight:(UIFontWeightMedium)];
        _titleLabel.textColor = UIColor.whiteColor;
    }
    return _titleLabel;
}

- (UILabel *)subTitleLabel {
    if (!_subTitleLabel) {
        _subTitleLabel = [[UILabel alloc]init];
        _subTitleLabel.font = [UIFont systemFontOfSize:11 weight:(UIFontWeightRegular)];
        _subTitleLabel.textColor = UIColor.whiteColor;
    }
    return _subTitleLabel;
}

- (UIImageView *)coverImage {
    if (!_coverImage) {
        _coverImage = [[UIImageView alloc]init];
        _coverImage.contentMode = UIViewContentModeScaleToFill;
        _coverImage.image = SEIMG(@"diccover_column_cover");
    }
    return _coverImage;
}
@end
